import { defineStore } from 'pinia'
import  {get} from "@/utils/request.js"

export const useCounterStore = defineStore('counter', {
  state: () => (
    { 
      count: 0,
      userList: []
    }
  ),
  getters: {
    doubleCount: (state) => state.count * 2,
  },
  actions: {
    increment () {
      this.count++
    },
   async  getUsers() {
  
    const response = await get('/public/data/db.json')
        console.log('请求成功:', response);
    // const data = await response.json()
    // console.log('请求成功:', data);
    this.userList = response

    


  },
}
})